#!/usr/bin/env python3
# -*- coding: UTF-8 -*-

'''
文件名称：main.py
创 建 者：yang qiang
创建日期：2021年02月26日
描    述：
Copyright (C) 2021 All rights reserved.
'''

import sys

num = int(input())
strs = list()

#while num:
#    try:
#        s = input()
#        strs.append(s)
#        num -= 1
#    except:
#        print("fsaf")
#        break

for s in sys.stdin:
    strs.append(s)

sorted(strs)
print(strs)


while True:
    try:
        N = int(input())
        list = []
        for i in range(N):
            list.append(input())
            pass
        for s in sorted(list):
            print(s)
    except:
        break
